package generator

import "beergo/plugins/maker"

func init() {
	Org()
	OrgStatus()
	OrgArticle()
	OrgArticleCategory()
}

func Org() {
	c := maker.CreateTable("Org","检验机构","check")
	c.AddManyToOne("user","所属用户","sys.User").SetSrcDir("sys")
	c.AddText("name","公司名称")
	c.AddText("logo","LOGO")
	c.AddText("license","营业执照")
	c.AddText("category","公司类型")
	c.AddText("startYear","成立时间")
	c.AddText("capital","注册资本")
	c.AddText("income","年产值")
	c.AddText("team","人员规模")
	c.AddText("area","地区")
	c.AddText("province","省份")
	c.AddText("city","城市")
	c.AddText("district","县区")
	c.AddText("address","详细地址")
	c.AddFloat("lat","lat")
	c.AddFloat("lon","lon")
	c.AddArt("about","关于我们")
	c.AddText("business","擅长领域")

	c.AddText("contact","联系人")
	c.AddText("phone","固定电话")
	c.AddText("email","邮箱")
	c.AddText("tags","资质")

	//审核信息
	c.AddManyToOne("status","审核状态","OrgStatus")

	c.AddText("note","审核意见")
	c.AddBool("isTop","首页置顶")
	c.AddAuth()
	c.AddLock()
	c.AddDelete()
	c.AddCreateAt()

	c.Generate()
}

func OrgStatus() {
	c := maker.CreateTable("OrgStatus","公司状态","check")
	c.LoadStatus()
	c.Generate()
}

func OrgArticle(){
	c := maker.CreateTable("OrgArticle","公司介绍文章","check")
	c.AddManyToOne("org","所属公司","Org")
	c.AddManyToOne("category","栏目","OrgArticleCategory")
	c.AddTitle()
	c.AddText("cover","封面")
	c.AddContent()
	c.AddCreateAt()
	c.Generate()
}

func OrgArticleCategory(){
	c := maker.CreateTable("OrgArticleCategory","公司介绍文章栏目","check")
	c.AddName()
	c.Generate()
}
